package com.atXiao.food.strategy.pay;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: lixiaoxiao
 * @date: 2024/1/11 14:57
 * @version: 1.0
 * @desc:
 */
public class PaymentFactory {


    private static Map<String, Payment> strategyMap = new HashMap<>();

    static {
        strategyMap.put(PaymentConst.ALIPAY, new AlipayStrategy());
        strategyMap.put(PaymentConst.WECHATPAY, new WechatpayStrategy());
        strategyMap.put(PaymentConst.UNIONPAY, new UnionpayStrategy());
        strategyMap.put(PaymentConst.NORMALPAY, new AlipayStrategy());
    }

    public static Payment getPaymentStrategyMap(String paymentKey) {
        Payment payment = strategyMap.get(paymentKey);
        return payment == null ? strategyMap.get(PaymentConst.NORMALPAY) : payment;
    }


}
